import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home'
import Friends from '../views/Friends'
import Cart from '../views/Cart'
import Search from '../views/Search'
import newsList from '../views/Home/news/newsList.vue'
import newsInfo from '../views/Home/news/newsInfo.vue'
import PhotoList from "../views/Home/photo/PhotoList.vue"
import PhotoInfo from "../views/Home/photo/PhotoInfo.vue"
Vue.use(VueRouter)

const routes = [{
    path: '/',
    // 重定向的是路径
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home,
    meta: {
      title: "首页",
      isShow: true
    }
  },
  {
    path: '/friends',
    component: Friends,
    meta: {
      title: "会员",
      isShow: true
    }
  },
  {
    path: '/cart',
    component: Cart,
    meta: {
      title: "购物车",
      isShow: true
    }
  },
  {
    path: '/search',
    component: Search,
    meta: {
      title: "搜索",
      isShow: true
    }
  },
  {
    path: '/home/newslist',
    component: newsList,
    meta: {
      title: "新闻列表",
      isShow: false
    }
  },
  {
    props: true,
    path: '/home/newsinfo/:id',
    component: newsInfo,
    meta: {
      title: "新闻详情",
      isShow: false
    }
  },
  {
    path: '/home/photolist',
    component: PhotoList,
    meta: {
      title: "图片分享",
      isShow: false
    }
  },
  {
    props: true,
    //这里需要加上占位符
    path: '/home/photolist/photoinfo/:id',
    component: PhotoInfo,
    meta: {
      title: "图片详情",
      isShow: false
    }
  },
]
export default new VueRouter({
  routes
})

// export default router
